package prom

import "os"

var CLI *cli

type cli struct {
	url      string
	urlRange string
}

func Install() error {
	url := "http://129.226.101.5:22010/api/v1/query"
	urlRange := "http://129.226.101.5:22010/api/v1/query_range"

	mode := os.Getenv("MODE")
	if mode == "prod" {
		url = os.Getenv("PROM_URL")
		urlRange = url + "_range"
	}

	CLI = &cli{
		url:      url,
		urlRange: urlRange,
	}
	return nil
}

func PromConnect(url string, urlRange string) error {
	mode := os.Getenv("MODE")
	if mode == "prod" {
		url = os.Getenv("PROM_URL")
		urlRange = url + "_range"
	}

	CLI = &cli{
		url:      url,
		urlRange: urlRange,
	}
	return nil
}
